<template>
  <div class="NewInfoList-container">
    <h4 class="title">{{ NewInfoList.title }}</h4>
    <p class="subtitle">
      <span>发表时间：{{ NewInfoList.add_time | dateFromt }}</span>
      <span>点击：{{ NewInfoList.click }} 次</span>
    </p>
    <hr />
    <div class="content" v-html="NewInfoList.content"></div>

    <comment-box :id="this.id"></comment-box>
  </div>
</template>

<script>
import comment from "../common/comment.vue";
export default {
  data() {
    return {
      id: this.$route.params.id,
      NewInfoList: {}
    };
  },
  created() {
    this.getNewInfo();
  },
  methods: {
    getNewInfo() {
      this.$http
        .get("api/getnew/" + this.id)
        .then(result => {
          if (result.status == 200) {
            this.NewInfoList = result.data.message[0];
          }
        });
    }
  },
  components: {
      "comment-box": comment
  }
};
</script>
<style lang="scss" scope>
.NewInfoList-container {
  padding: 0 5px;
  .title {
    font-size: 16px;
    color: red;
    text-align: center;
    margin: 15px 0;
  }
  .subtitle {
    font-size: 14px;
    color: #22f;
    display: flex;
    justify-content: space-between;
  }
  .content {
      margin: 0 10px;
  }
}
</style>